$(document).ready(function(){
	var memberId = $("#memberId").val();
	$("#Old_password").attr("ajaxurl","../validatePass.do?memberId="+memberId);
	
	
var validObject = $("#resetPassInfo").Validform({
		
		dataType:'text',
		tiptype:2,
		type:"POST",
		ajaxPost:true,
		callback:function(data){
			if(data==0){
        		window.location.assign(basePath+"/index.jsp");
        	}
        	else if(data==1){
        		
        		alert("登陆失败，如果邮箱登陆失败的话，可能是还没激活！");
        	}
        	else{
        		alert("验证码错误!");
        		var obj = document.getElementById("checkCode");
				changeValidateCode(obj);
        	}
		},
		
		tiptype:function(msg,o,cssctl){
			
			if(!o.obj.is("form")){
				var tds=o.obj.text();
				
				var objtip=o.obj.siblings(".Validform_checktip");
				cssctl(objtip,o.type);
				objtip.text(msg);
			
				
			}	
			
		}
	
	});
	$("#resetPassInfo").delegate('#Old_password', 'change', function() {
	validObject.config({
	 ajaxurl:{
	        success:function(data,obj){
	        	if(data.status=="y"){
	        		$(".revisePassTip").removeAttr("disabled");
	        	}else{
	        		$(".revisePassTip").attr("disabled","disabled");
	        	}
	        	
	           
	        },
	    	 error:function(data,obj){
		            alert("error:"+data+obj);
		        }
	        
	    }
		
		
	});

});
});

function vilidate() {
	var pass = document.getElementById("New_password").value;
	var vilidate_pass = document.getElementById("validatePass").value;
	alert("pass:" + pass + "vilidate_pass::" + vilidate_pass);
	if (pass != vilidate_pass) {
		alert("密码不一致");
		return false;
	}
	return true;
}
function sentToService() {
	var old = document.getElementById("Old_password").value;
	var id = document.getElementById("memberId").value;
	$.ajax({
		url : "./validate.do",
		type : "POST",
		dataType : "text",
		data : {
			id : id,
			Old_password : old
		},
		success : function(data) {
			alert(data);
		},
		error : function(data) {
			alert(data);
		}
		
	});
}